clear all
clc
load M.mat

Es = 1.01862
E = 1.5
Delta_B = 0.0005
n = 6

Average_Ls = mean(M(1,:))
Average_Lx = mean(M(2,:))

Uncertainty_A_Ls = sqrt(sum((M(1,:)-Average_Ls).^2)/((n-1).*n))
Uncertainty_A_Lx = sqrt(sum((M(2,:)-Average_Lx).^2)/((n-1).*n))

Composite_Uncertainty_Ls = sqrt(Uncertainty_A_Ls.^2+(Delta_B./sqrt(3)).^2)
Composite_Uncertainty_Lx = sqrt(Uncertainty_A_Lx.^2+(Delta_B./sqrt(3)).^2)

Average_Ex = sum(Es.*M(2,:)./M(1,:))./n

Ex = Es.*sqrt((Composite_Uncertainty_Lx./Average_Ls).^2 + ((Average_Lx.^2).*(Composite_Uncertainty_Ls).^2)./Average_Ls.^4)

Relative_Uncertainty_Ex = Ex./Average_Ex